home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d20 / mpi100.arc / PARSE.PAS < prev    next >
Pascal/Delphi Source File  |  1991-06-22  |  794b  |  37 lines

  1. unit Parse;
  2. interface
  3. var
  4.   EndTerm   :  integer;
  5.   Term      :  array[1..64] of string;
  6.  
  7. procedure Parseln(Line:string);
  8.  
  9. implementation
  10.  
  11. procedure Parseln(Line:string);
  12.   var
  13.     Marker  :  integer;
  14.     Extra   :  integer;
  15.   begin
  16.   while Pos(#9,Line)>0 do Line[Pos(#9,Line)] := #32;
  17.   while Line[1] = #32 do Delete(Line,1,1);
  18.   while Line[Length(Line)] = #32 do Dec(Line[0]);
  19.   if Line <> '' then
  20.     begin
  21.     EndTerm  := 0;
  22.     while Pos(#32,Line)>0 do
  23.       begin
  24.       Extra    := 0;
  25.       Inc(EndTerm);
  26.       Marker := Pos(#32,Line);
  27.       while Line[Marker+Extra] = #32 do Inc(Extra);
  28.       Term[EndTerm] := Copy(Line,1,Marker-1);
  29.       Delete(Line,1,Marker+(Extra-1));
  30.       end;
  31.     Inc(EndTerm);
  32.     Term[EndTerm] := Line;
  33.     end;
  34.   end;
  35.  
  36. end.
  37.